<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include file="common.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String id = request.getParameter("id");
String deviceId = request.getParameter("deviceId");
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="font-size: 100px;">
  <head>
    <base href="<%=basePath%>">
    
    <title>智慧消防</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	  <link rel="stylesheet" href="<%=path %>/css/common.css" type="text/css"></link>
	  <link href="<%=request.getContextPath()%>/css/bootstrap.min.css" rel="stylesheet">
	<script type="text/javascript">
	    function submitHandleResult(){
	    	var url = '${linkPath}smartfire/wx/operationList/submitHandleResult';
	    	var handlerResult = $("#handlerResult").val();
            if($.trim(handlerResult)==""){
                $('#handlerResult').focus();
                $('span.handlerResult').html("处理结果不能为空");
                return false;
            }
	    	var id = <%=id %>;
            var attachment = $("#attachment").html();
	    	var data = {
	    		id: id,
	    		handlerResult: handlerResult,
                handImg:attachment
	    	};
	    	$.ajax({
		        url:url,
		        type: 'post',
		        data: data,
                beforeSend: function(request) {
                    request.setRequestHeader("ACCESS-TOKEN", token);
                },
		        success: function(res){
		           if(res.success){
		           		myAlert("处理结果添加成功");
					   setTimeout(function(){
						   location.href ='<%=path %>/login/mine.jsp';
					   },1000);
		           }
		        },
		        error: function(error){
		            console.log(error);
		        }
		    });
  		}
	</script>
  </head>
  
  <body>
  <div class="bar">
	  <div class="naviBar">
		  <img onclick="javascript:history.back(-1);" src="<%=path %>/images/common/return.png" alt="">
		  <span>维保任务</span>
	  </div>
	  <div class="col-sm-6" style="margin-top: 0.40rem;padding-bottom: 0.4rem">
		  <div class="ibox float-e-margins" style="padding-top: 10px;">
			  <div class="ibox-content" style="display: block;">
				  <%-- <form class="form-horizontal m-t" id="signupForm" novalidate="novalidate">--%>
				  <div class="form-group">
					  <label class="col-sm-3 control-label">设备ID：</label>
					  <div class="col-sm-8">
						  <input id="deviceId" name="deviceId" class="form-control" type="text" value ="<%=deviceId %>" readonly>
						  <span class="help-block m-b-none deviceId"><i class="fa fa-info-circle"></i> </span>
					  </div>
				  </div>
				  <div class="form-group">
					  <label class="col-sm-3 control-label">图片：</label>
					  <div class="col-sm-8">
						  <form id= "uploadForm" style="margin-bottom: 0">
							  <div class="input-group">
								  <label for="file" class="input-group-addon" onclick="checkImg()" >选择图片</label>
								  <input type="file" id="file" name="file" style="display: none;">
								  <input type="text" class="form-control file" placeholder="图片路径">
								  <div id="attachment" fieldName="handImg" style="display: none;"></div>
							  </div>
						  </form>
					  </div>
				  </div>
				  <div class="form-group">
					  <label class="col-sm-3 control-label">处理结果：</label>
					  <div class="col-sm-8">
						  <textarea id="handlerResult" name="handlerResult" class="form-control"></textarea>
						  <span class="help-block m-b-none handlerResult"><i class="fa fa-info-circle"></i> </span>
					  </div>
				  </div>

				  <div class="form-group" style="padding-top: 10px">
					  <div class="col-sm-8 col-sm-offset-3">
						  <button class="btn btn-primary" style="width: 100%"  onclick="submitHandleResult()">提交</button>
					  </div>
				  </div>
			  </div>
		  </div>
	  </div>
  </div>
  </body>
  <script type="text/javascript" src="<%=request.getContextPath()%>/js/uploadOneImg.js"></script>
</html>
